CREATE TABLE [dbo].[tb_PlazasDeMovimiento]
(
[idPlaza] [int] NOT NULL,
[idCola] [int] NOT NULL,
[Servicio] [int] NULL,
[Estado] [int] NULL,
[PlazaDestino] [int] NULL,
[Enfermedad] [int] NULL,
[Titularizar] [varchar] (1) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[RectificaA] [int] NULL,
[RelInterServicio] [int] NULL,
[Borrar] [varchar] (1) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[HorasDePlaza] [varchar] (1) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[CausaAlta] [int] NULL,
[CausaBaja] [int] NULL,
[Confirmada] [varchar] (1) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[idServicioRelacionado] [int] NULL CONSTRAINT [DF_tb_PlazasDeMovimiento_idServicioRelacionado] DEFAULT ((-1)),
[FechaDeLicencia] [int] NULL,
[ObligacionesADescontar] [int] NULL,
[idplazasdemovimientos] [int] NOT NULL IDENTITY(1, 1),
[IdServicioBase] [int] NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[tb_PlazasDeMovimiento] ADD CONSTRAINT [PK_tb_PlazasDeMovimiento] PRIMARY KEY CLUSTERED  ([idplazasdemovimientos]) WITH (FILLFACTOR=90) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [idxcolarectifica] ON [dbo].[tb_PlazasDeMovimiento] ([idCola], [RectificaA]) WITH (FILLFACTOR=90) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [IDX_Servicio] ON [dbo].[tb_PlazasDeMovimiento] ([IdServicioBase]) WITH (FILLFACTOR=90) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [IDX_SubServicio] ON [dbo].[tb_PlazasDeMovimiento] ([Servicio]) WITH (FILLFACTOR=90) ON [PRIMARY]
GO
ALTER TABLE [dbo].[tb_PlazasDeMovimiento] ADD CONSTRAINT [FK_tb_PlazasDeMovimiento_tb_ColaDeMovimientos] FOREIGN KEY ([idCola]) REFERENCES [dbo].[tb_ColaDeMovimientos] ([idCola])
GO
